package com.jrx.anytxn.transaction.job.autoPayment.step;

import com.jrx.anytxn.transaction.entity.BtAutoPaymentList;
import com.jrx.anytxn.transaction.mapper.ext.ExtBtAutoPaymentListMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 第一次批扣写
 *
 * @author : zhenghaopu
 * 2019/11/22
 */
@Service
public class AutoPaymentSecondInitWriter implements ItemWriter<BtAutoPaymentList> {

    @Resource
    private ExtBtAutoPaymentListMapper extBtAutoPaymentListMapper;

    @Override
    public void write(List<? extends BtAutoPaymentList> items) {
        if(CollectionUtils.isNotEmpty(items)){
            extBtAutoPaymentListMapper.batchInsert((List<BtAutoPaymentList>)items);
        }
    }
}
